#define __display_c

#include    "includeAll.h"

code const uint8_t displayFonts[10] =
{
    0x3f,  /*0*/
    0x06,  /*1*/
    0x5b,  /*2*/
    0x4f,  /*3*/
    0x66,  /*4*/
    0x6d,  /*5*/
    0x7d,  /*6*/
    0x07,  /*7*/
    0x7f,  /*8*/
    0x6f,  /*9*/
};

void DisplayScan(void)
{

	displayBuffer[0]   =0x00;
 	displayBuffer[1]   =0x00;
 	displayBuffer[2]   =0x00;
 	displayBuffer[3]   =0x00;
 	displayBuffer[4]   =0x00;
 	displayBuffer[5]   =0x00;
 	displayBuffer[6]   =0x00;
 	displayBuffer[7]   =0x00;
 	displayBuffer[8]   =0x00;
 	displayBuffer[9]   =0x00;
 	displayBuffer[10]  =0x00;
	displayBuffer[11]  =0x00;
	displayBuffer[12]  =0x00;
	displayBuffer[13]  =0x00;
	displayBuffer[14]  =0x00;
	displayBuffer[15]  =0x00;
	
		if(bSecFlash500ms)
		{
			clockFlagOn;
		}
    curTempFlagOn;
  //d_seg=displayFonts[bNoClock];
    d_seg=displayFonts[curTemp/10];
    if(f_seg_a)    {set_led_1a;  set_led_2a;}
    if(f_seg_b)    {set_led_1b;  set_led_2b;}
    if(f_seg_c)    {set_led_1c;  set_led_2c;}
    if(f_seg_d)    {set_led_1d;  set_led_2d;}
    if(f_seg_e)    {set_led_1e;  set_led_2e;}
    if(f_seg_f)    {set_led_1f;  set_led_2f;}
    if(f_seg_g)    {set_led_1g;  set_led_2g;}

    d_seg=displayFonts[curTemp%10];
    if(f_seg_a)    {set_led_3a;  set_led_4a;}
    if(f_seg_b)    {set_led_3b;  set_led_4b;}
    if(f_seg_c)    {set_led_3c;  set_led_4c;}
    if(f_seg_d)    {set_led_3d;  set_led_4d;}
    if(f_seg_e)    {set_led_3e;  set_led_4e;}
    if(f_seg_f)    {set_led_3f;  set_led_4f;}
    if(f_seg_g)    {set_led_3g;  set_led_4g;}
    if(bPowerOnOff)
    {
        setTempChar1On;
        setTempChar2On;
        setTempFlagOn;
        d_seg=displayFonts[setCurTemp/10];
        if(f_seg_a)    set_led_5a;
        if(f_seg_b)    set_led_5b;
        if(f_seg_c)    set_led_5c;
        if(f_seg_d)    set_led_5d;
        if(f_seg_e)    set_led_5e;
        if(f_seg_f)    set_led_5f;
        if(f_seg_g)    set_led_5g;

        d_seg=displayFonts[setCurTemp%10];
        if(f_seg_a)    set_led_6a;
        if(f_seg_b)    set_led_6b;
        if(f_seg_c)    set_led_6c;
        if(f_seg_d)    set_led_6d;
        if(f_seg_e)    set_led_6e;
        if(f_seg_f)    set_led_6f;
        if(f_seg_g)    set_led_6g;

   
        gearCharOn;
        d_seg=displayFonts[gear];
        if(f_seg_a)    set_led_7a;
        if(f_seg_b)    set_led_7b;
        if(f_seg_c)    set_led_7c;
        if(f_seg_d)    set_led_7d;
        if(f_seg_e)    set_led_7e;
        if(f_seg_f)    set_led_7f;
        if(f_seg_g)    set_led_7g;

		switch(function)
		{
			
			case 1:
			   lowWorkCharOn;
			break;
			
			case 2:
				highWorkCharOn;
			break;
			
			case 3:
				killWorkCharOn;
			break;
			
		}
     
			
		if((bSaveTemp==0)&&(bOrderOpen==0))
        {
            heatCharOn;
			if(bSecFlash500ms)
			{
				DengDai();
			}
        }
        else
        {
            saveTempCharOn;
			DengDai();
        } 
		
		
		if(flashSheZhi<=0)
		{
			if(bOrderOpen)
			{
				orderOpenOn;
			}
			else if(bOrderClose)
			{
				orderCloseOn;
			}
			if((bOrderClose)||(bOrderOpen))
			{
				if((mainClockHour<=7)&&(mainClockHour>=0))
				{
					ZaoShangCharOn;
				}
				if((mainClockHour<=15)&&(mainClockHour>7))
				{
					XiaWuCharOn;
				}
				if((mainClockHour<=23)&&(mainClockHour>15))
				{
					WanShangCharOn;
				}
			}
		}
    }

   

	switch(sheZhiNum)
    {
     case 0:
	 case 1:
	 case 2:
	 case 3:
    case 4:
    case 5:

        clockHour=mainClockHour;
		clockMin=mainClockMin;
        clockCharOn;
        break;


    case 6:
    case 7:
        clockHour =MorderClockOpenHour;
        clockMin  =MorderClockOpenMin;
        orderOpenOn;
		ZaoShangCharOn;
        break;


    case 8:
    case 9:
        clockHour =MorderClockCloseHour;
        clockMin  =MorderClockCloseMin;
        orderCloseOn;
		ZaoShangCharOn;
        break;
	case 10:
    case 11:
        clockHour =AorderClockOpenHour;
        clockMin  =AorderClockOpenMin;
        orderOpenOn;
		XiaWuCharOn;
        break;


    case 12:
    case 13:
        clockHour =AorderClockCloseHour;
        clockMin  =AorderClockCloseMin;
        orderCloseOn;
		XiaWuCharOn;
        break;	
		
	case 14:
    case 15:
        clockHour =NorderClockOpenHour;
        clockMin  =NorderClockOpenMin;
        orderOpenOn;
		WanShangCharOn;
        break;


    case 16:
    case 17:
        clockHour =NorderClockCloseHour;
        clockMin  =NorderClockCloseMin;
        orderCloseOn;
		WanShangCharOn;
        break;	
    
    }
    d_seg=displayFonts[clockHour/10];
    if(f_seg_a)    set_led_8a;
    if(f_seg_b)    set_led_8b;
    if(f_seg_c)    set_led_8c;
    if(f_seg_d)    set_led_8d;
    if(f_seg_e)    set_led_8e;
    if(f_seg_f)    set_led_8f;
    if(f_seg_g)    set_led_8g;

    d_seg=displayFonts[clockHour%10];
    if(f_seg_a)    set_led_9a;
    if(f_seg_b)    set_led_9b;
    if(f_seg_c)    set_led_9c;
    if(f_seg_d)    set_led_9d;
    if(f_seg_e)    set_led_9e;
    if(f_seg_f)     set_led_9f;
    if(f_seg_g)    set_led_9g;


    d_seg=displayFonts[clockMin/10];
    if(f_seg_a)    set_led_10a;
    if(f_seg_b)    set_led_10b;
    if(f_seg_c)    set_led_10c;
    if(f_seg_d)    set_led_10d;
    if(f_seg_e)    set_led_10e;
    if(f_seg_f)     set_led_10f;
    if(f_seg_g)    set_led_10g;

    d_seg=displayFonts[clockMin%10];
    if(f_seg_a)    set_led_11a;
    if(f_seg_b)    set_led_11b;
    if(f_seg_c)    set_led_11c;
    if(f_seg_d)    set_led_11d;
    if(f_seg_e)    set_led_11e;
    if(f_seg_f)     set_led_11f;
    if(f_seg_g)    set_led_11g;

	
	
}


void DengDai()
{
	if(bPeople==0)
	{
		if(curTemp<=50)
			{
					blueLedOn;
					setBlue;
					clrRed;
			}
			else if((curTemp<=60)&&(curTemp>50))
			{
					blueLedOn;
					redLedOn;
					clrRed;
					clrBlue;
			}
			else if((curTemp>60)&&(curTemp<=90))
			{
					redLedOn;
					setRed;
					clrBlue;
			}
	}
	else
	{
		setRed;
		setBlue;
	}
}